package com.ivan.stu.notetool.utils;

import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.support.v7.widget.PopupMenu;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListView;
import android.widget.PopupWindow;


import com.ivan.stu.notetool.R;
import com.ivan.stu.notetool.adapter.NoteSubjectAdapter;

import java.util.List;

/**
 * Created by IVAN on 2018/7/7.
 */

public class PopupWindowManager {

    private static  PopupWindow popClass;

    public static void showPopMenu(final Context context, View view, final int pos) {
        PopupMenu popupMenu = new PopupMenu(context,view);
        popupMenu.getMenuInflater().inflate(R.menu.lgnotelib_item_delete_menu, popupMenu.getMenu());
        popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
            public boolean onMenuItemClick(MenuItem item) {

                Log.v("点击了：",item.getTitle()+"");

                //在这进行删除笔记的逻辑

                //myAdapter.removeItem(pos);
                return false;
            }
        });
        popupMenu.setOnDismissListener(new PopupMenu.OnDismissListener() {
            @Override
            public void onDismiss(PopupMenu menu) {
             //   Toast.makeText(context, "关闭PopupMenu", Toast.LENGTH_SHORT).show();


            }
        });
        popupMenu.show();
    }




    public interface ImageEventListener{

         void onAlbumClick(PopupWindow popupWindow);
         void onCameraClick(PopupWindow popupWindow);
         void onCancelClick(PopupWindow popupWindow);

    }



    public interface PopClassEventListener{

        void onPopClassDismiss(View popClass);
        void onItemSelected(NoteSubjectAdapter adapter, PopupWindow popClass, int Position);
    }
}
